QCameraParameters.h revision 6f83d735d8e3b918da42e6b559fcd0efb78133e5
1/*
2**
3** Copyright 2008, The Android Open Source Project
4** Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
5** Not a Contribution. Apache license notifications and license are
6** retained for attribution purposes only.
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#ifndef ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
21#define ANDROID_HARDWARE_QCAMERA_PARAMETERS_H
22
23#include <camera/CameraParameters.h>
24#include <cutils/properties.h>
25#include <hardware/camera.h>
26#include <stdlib.h>
27#include <utils/Errors.h>
28#include "cam_intf.h"
29#include "QCameraMem.h"
30#include "QCameraThermalAdapter.h"
31
32extern "C" {
33#include <mm_jpeg_interface.h>
34}
35
36using namespace android;
37
38namespace qcamera {
39
40//EXIF globals
41static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };          // "ASCII\0\0\0"
42static const char ExifUndefinedPrefix[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };   // "\0\0\0\0\0\0\0\0"
43
44#define GPS_PROCESSING_METHOD_SIZE       101
45#define EXIF_ASCII_PREFIX_SIZE           8   //(sizeof(ExifAsciiPrefix))
46#define FOCAL_LENGTH_DECIMAL_PRECISION   100
47
48class QCameraParameters: public CameraParameters
49{
50public:
51    QCameraParameters();
52    QCameraParameters(const String8 &params);
53    ~QCameraParameters();
54
55    // Supported PREVIEW/RECORDING SIZES IN HIGH FRAME RATE recording, sizes in pixels.
56    // Example value: "800x480,432x320". Read only.
57    static const char KEY_QC_SUPPORTED_HFR_SIZES[];
58    // The mode of preview frame rate.
59    // Example value: "frame-rate-auto, frame-rate-fixed".
60    static const char KEY_QC_PREVIEW_FRAME_RATE_MODE[];
61    static const char KEY_QC_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
62    static const char KEY_QC_PREVIEW_FRAME_RATE_AUTO_MODE[];
63    static const char KEY_QC_PREVIEW_FRAME_RATE_FIXED_MODE[];
64    static const char KEY_QC_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] ;
65
66    // Supported live snapshot sizes
67    static const char KEY_QC_SUPPORTED_LIVESNAPSHOT_SIZES[];
68
69    // Supported Raw formats
70    static const char KEY_QC_SUPPORTED_RAW_FORMATS[];
71    static const char KEY_QC_RAW_FORMAT[];
72
73    //Touch Af/AEC settings.
74    static const char KEY_QC_TOUCH_AF_AEC[];
75    static const char KEY_QC_SUPPORTED_TOUCH_AF_AEC[];
76    //Touch Index for AEC.
77    static const char KEY_QC_TOUCH_INDEX_AEC[];
78    //Touch Index for AF.
79    static const char KEY_QC_TOUCH_INDEX_AF[];
80    // Current auto scene detection mode.
81    // Example value: "off" or "on" constants. Read/write.
82    static const char KEY_QC_SCENE_DETECT[];
83    // Supported auto scene detection settings.
84    // Example value: "off,on". Read only.
85    static const char KEY_QC_SUPPORTED_SCENE_DETECT[];
86    static const char KEY_QC_SELECTABLE_ZONE_AF[];
87
88    static const char KEY_QC_ISO_MODE[];
89    static const char KEY_QC_SUPPORTED_ISO_MODES[];
90    static const char KEY_QC_LENSSHADE[] ;
91    static const char KEY_QC_SUPPORTED_LENSSHADE_MODES[] ;
92    static const char KEY_QC_AUTO_EXPOSURE[];
93    static const char KEY_QC_SUPPORTED_AUTO_EXPOSURE[];
94
95    static const char KEY_QC_GPS_LATITUDE_REF[];
96    static const char KEY_QC_GPS_LONGITUDE_REF[];
97    static const char KEY_QC_GPS_ALTITUDE_REF[];
98    static const char KEY_QC_GPS_STATUS[];
99    static const char KEY_QC_MEMORY_COLOR_ENHANCEMENT[];
100    static const char KEY_QC_SUPPORTED_MEM_COLOR_ENHANCE_MODES[];
101    static const char KEY_QC_DIS[];
102    static const char KEY_QC_SUPPORTED_DIS_MODES[];
103
104    static const char KEY_QC_ZSL[];
105    static const char KEY_QC_SUPPORTED_ZSL_MODES[];
106    static const char KEY_QC_ZSL_BURST_INTERVAL[];
107    static const char KEY_QC_ZSL_BURST_LOOKBACK[];
108    static const char KEY_QC_ZSL_QUEUE_DEPTH[];
109
110    static const char KEY_QC_CAMERA_MODE[];
111    static const char KEY_QC_ORIENTATION[];
112
113    static const char KEY_QC_VIDEO_HIGH_FRAME_RATE[];
114    static const char KEY_QC_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[];
115    static const char KEY_QC_HIGH_DYNAMIC_RANGE_IMAGING[];
116    static const char KEY_QC_SUPPORTED_HDR_IMAGING_MODES[];
117    static const char KEY_QC_AE_BRACKET_HDR[];
118    static const char KEY_QC_SUPPORTED_AE_BRACKET_MODES[];
119    static const char KEY_QC_CAPTURE_BURST_EXPOSURE[];
120    static const char KEY_QC_NUM_SNAPSHOT_PER_SHUTTER[];
121    static const char KEY_QC_NO_DISPLAY_MODE[];
122    static const char KEY_QC_RAW_PICUTRE_SIZE[];
123
124    // DENOISE
125    static const char KEY_QC_DENOISE[];
126    static const char KEY_QC_SUPPORTED_DENOISE[];
127
128    //Selectable zone AF.
129    static const char KEY_QC_FOCUS_ALGO[];
130    static const char KEY_QC_SUPPORTED_FOCUS_ALGOS[];
131
132    //Face Detection
133    static const char KEY_QC_FACE_DETECTION[];
134    static const char KEY_QC_SUPPORTED_FACE_DETECTION[];
135
136    //Face Recognition
137    static const char KEY_QC_FACE_RECOGNITION[];
138    static const char KEY_QC_SUPPORTED_FACE_RECOGNITION[];
139
140    // supported camera features to be queried by Snapdragon SDK
141    //Read only
142    static const char KEY_QC_SUPPORTED_CAMERA_FEATURES[];
143
144    //Indicates number of faces requested by the application.
145    //This value will be rejected if the requested faces
146    //greater than supported by hardware.
147    //Write only.
148    static const char KEY_QC_MAX_NUM_REQUESTED_FACES[];
149
150    //preview flip
151    static const char KEY_QC_PREVIEW_FLIP[];
152    //video flip
153    static const char KEY_QC_VIDEO_FLIP[];
154    //snapshot picture flip
155    static const char KEY_QC_SNAPSHOT_PICTURE_FLIP[];
156
157    static const char KEY_QC_SUPPORTED_FLIP_MODES[];
158
159    //Redeye Reduction
160    static const char KEY_QC_REDEYE_REDUCTION[];
161    static const char KEY_QC_SUPPORTED_REDEYE_REDUCTION[];
162    static const char EFFECT_EMBOSS[];
163    static const char EFFECT_SKETCH[];
164    static const char EFFECT_NEON[];
165
166    // Values for Touch AF/AEC
167    static const char TOUCH_AF_AEC_OFF[];
168    static const char TOUCH_AF_AEC_ON[];
169
170    // Values for Scene mode
171    static const char SCENE_MODE_ASD[];
172    static const char SCENE_MODE_BACKLIGHT[];
173    static const char SCENE_MODE_FLOWERS[];
174    static const char SCENE_MODE_AR[];
175    static const char SCENE_MODE_HDR[];
176    static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO
177    static const char PIXEL_FORMAT_YV12[]; // NV12
178    static const char PIXEL_FORMAT_NV12[]; //NV12
179
180    // Values for raw picture format
181    static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YUYV[];
182    static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_YVYU[];
183    static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_UYVY[];
184    static const char QC_PIXEL_FORMAT_YUV_RAW_8BIT_VYUY[];
185    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GBRG[];
186    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8GRBG[];
187    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8RGGB[];
188    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_8BGGR[];
189    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GBRG[];
190    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10GRBG[];
191    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10RGGB[];
192    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_10BGGR[];
193    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GBRG[];
194    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12GRBG[];
195    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12RGGB[];
196    static const char QC_PIXEL_FORMAT_BAYER_QCOM_RAW_12BGGR[];
197    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GBRG[];
198    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8GRBG[];
199    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8RGGB[];
200    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_8BGGR[];
201    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GBRG[];
202    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10GRBG[];
203    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10RGGB[];
204    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_10BGGR[];
205    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GBRG[];
206    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12GRBG[];
207    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12RGGB[];
208    static const char QC_PIXEL_FORMAT_BAYER_MIPI_RAW_12BGGR[];
209    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GBRG[];
210    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8GRBG[];
211    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8RGGB[];
212    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_8BGGR[];
213    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GBRG[];
214    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10GRBG[];
215    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10RGGB[];
216    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_10BGGR[];
217    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GBRG[];
218    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12GRBG[];
219    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12RGGB[];
220    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_QCOM_12BGGR[];
221    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GBRG[];
222    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8GRBG[];
223    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8RGGB[];
224    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_8BGGR[];
225    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GBRG[];
226    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10GRBG[];
227    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10RGGB[];
228    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_10BGGR[];
229    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GBRG[];
230    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12GRBG[];
231    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12RGGB[];
232    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_MIPI_12BGGR[];
233    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GBRG[];
234    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8GRBG[];
235    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8RGGB[];
236    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN8_8BGGR[];
237    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GBRG[];
238    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8GRBG[];
239    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8RGGB[];
240    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_8BGGR[];
241    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GBRG[];
242    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10GRBG[];
243    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10RGGB[];
244    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_10BGGR[];
245    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GBRG[];
246    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12GRBG[];
247    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12RGGB[];
248    static const char QC_PIXEL_FORMAT_BAYER_IDEAL_PLAIN16_12BGGR[];
249
250    // ISO values
251    static const char ISO_AUTO[];
252    static const char ISO_HJR[];
253    static const char ISO_100[];
254    static const char ISO_200[];
255    static const char ISO_400[];
256    static const char ISO_800[];
257    static const char ISO_1600[];
258
259    // Values for auto exposure settings.
260    static const char AUTO_EXPOSURE_FRAME_AVG[];
261    static const char AUTO_EXPOSURE_CENTER_WEIGHTED[];
262    static const char AUTO_EXPOSURE_SPOT_METERING[];
263    static const char AUTO_EXPOSURE_SMART_METERING[];
264    static const char AUTO_EXPOSURE_USER_METERING[];
265    static const char AUTO_EXPOSURE_SPOT_METERING_ADV[];
266    static const char AUTO_EXPOSURE_CENTER_WEIGHTED_ADV[];
267
268    static const char KEY_QC_SHARPNESS[];
269    static const char KEY_QC_MIN_SHARPNESS[];
270    static const char KEY_QC_MAX_SHARPNESS[];
271    static const char KEY_QC_SHARPNESS_STEP[];
272    static const char KEY_QC_CONTRAST[];
273    static const char KEY_QC_MIN_CONTRAST[];
274    static const char KEY_QC_MAX_CONTRAST[];
275    static const char KEY_QC_CONTRAST_STEP[];
276    static const char KEY_QC_SATURATION[];
277    static const char KEY_QC_MIN_SATURATION[];
278    static const char KEY_QC_MAX_SATURATION[];
279    static const char KEY_QC_SATURATION_STEP[];
280    static const char KEY_QC_BRIGHTNESS[];
281    static const char KEY_QC_MIN_BRIGHTNESS[];
282    static const char KEY_QC_MAX_BRIGHTNESS[];
283    static const char KEY_QC_BRIGHTNESS_STEP[];
284    static const char KEY_QC_SCE_FACTOR[];
285    static const char KEY_QC_MIN_SCE_FACTOR[];
286    static const char KEY_QC_MAX_SCE_FACTOR[];
287    static const char KEY_QC_SCE_FACTOR_STEP[];
288
289    static const char KEY_QC_HISTOGRAM[] ;
290    static const char KEY_QC_SUPPORTED_HISTOGRAM_MODES[] ;
291    static const char KEY_QC_HDR_NEED_1X[];
292
293    // Values for SKIN TONE ENHANCEMENT
294    static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ;
295    static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ;
296
297    // Values for Denoise
298    static const char DENOISE_OFF[] ;
299    static const char DENOISE_ON[] ;
300
301    // Values for auto exposure settings.
302    static const char FOCUS_ALGO_AUTO[];
303    static const char FOCUS_ALGO_SPOT_METERING[];
304    static const char FOCUS_ALGO_CENTER_WEIGHTED[];
305    static const char FOCUS_ALGO_FRAME_AVERAGE[];
306
307    // Values for AE Bracketing settings.
308    static const char AE_BRACKET_OFF[];
309    static const char AE_BRACKET[];
310
311    // Values for HFR settings.
312    static const char VIDEO_HFR_OFF[];
313    static const char VIDEO_HFR_2X[];
314    static const char VIDEO_HFR_3X[];
315    static const char VIDEO_HFR_4X[];
316    static const char VIDEO_HFR_5X[];
317
318    // Values for feature on/off settings.
319    static const char VALUE_OFF[];
320    static const char VALUE_ON[];
321
322    // Values for feature enable/disable settings.
323    static const char VALUE_ENABLE[];
324    static const char VALUE_DISABLE[];
325
326    // Values for feature true/false settings.
327    static const char VALUE_FALSE[];
328    static const char VALUE_TRUE[];
329
330    //Values for flip settings
331    static const char FLIP_MODE_OFF[];
332    static const char FLIP_MODE_V[];
333    static const char FLIP_MODE_H[];
334    static const char FLIP_MODE_VH[];
335
336    enum {
337        CAMERA_ORIENTATION_UNKNOWN = 0,
338        CAMERA_ORIENTATION_PORTRAIT = 1,
339        CAMERA_ORIENTATION_LANDSCAPE = 2,
340    };
341    typedef struct {
342        const char *const desc;
343        int val;
344    } QCameraMap;
345
346    void getSupportedHfrSizes(Vector<Size> &sizes);
347    void setPreviewFrameRateMode(const char *mode);
348    const char *getPreviewFrameRateMode() const;
349    void setTouchIndexAec(int x, int y);
350    void getTouchIndexAec(int *x, int *y);
351    void setTouchIndexAf(int x, int y);
352    void getTouchIndexAf(int *x, int *y);
353
354    int32_t init(cam_capability_t *, mm_camera_vtbl_t *);
355    void deinit();
356    int32_t assign(QCameraParameters& params);
357    int32_t initDefaultParameters();
358    int32_t updateParameters(QCameraParameters&, bool &needRestart);
359    int32_t commitParameters();
360    int getPreviewHalPixelFormat() const;
361    int32_t getStreamFormat(cam_stream_type_t streamType,
362                             cam_format_t &format);
363    int32_t getStreamDimension(cam_stream_type_t streamType,
364                                cam_dimension_t &dim);
365    void getThumbnailSize(int *width, int *height) const;
366
367    int getZSLBurstInterval();
368    int getZSLQueueDepth();
369    int getZSLBackLookCount();
370    int getMaxUnmatchedFramesInQueue();
371    bool isZSLMode() {return m_bZslMode;};
372    bool isNoDisplayMode() {return m_bNoDisplayMode;};
373    bool isWNREnabled() {return m_bWNROn;};
374    uint8_t getNumOfSnapshots();
375    uint8_t getNumOfExtraHDRBufsIfNeeded();
376    uint8_t getNumOfHDRBufsIfNeeded();
377    int getBurstNum();
378    bool getRecordingHintValue() {return m_bRecordingHint;}; // return local copy of video hint
379    int setRecordingHintValue(int32_t value); // set local copy of video hint and send to server
380                                              // no change in parameters value
381    int getJpegQuality();
382    int getJpegRotation();
383
384    int32_t getExifDateTime(char *dateTime, uint32_t &count);
385    int32_t getExifFocalLength(rat_t *focalLenght);
386    uint16_t getExifIsoSpeed();
387    int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, uint32_t &count);
388    int32_t getExifLatitude(rat_t *latitude, char *latRef);
389    int32_t getExifLongitude(rat_t *longitude, char *lonRef);
390    int32_t getExifAltitude(rat_t *altitude, char *altRef);
391    int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, uint32_t bufLen, rat_t *gpsTimeStamp);
392    int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances);
393
394    bool isFpsDebugEnabled() {return m_bDebugFps;};
395    bool isHistogramEnabled() {return m_bHistogramEnabled;};
396    bool isFaceDetectionEnabled() {return ((m_nFaceProcMask & CAM_FACE_PROCESS_MASK_DETECTION) != 0);};
397    int32_t setHistogram(bool enabled);
398    int32_t setFaceDetection(bool enabled);
399    int32_t setLockCAF(bool bLock);
400    int32_t setBundleInfo(cam_bundle_config_t &bundle_info);
401    int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern);
402    qcamera_thermal_mode getThermalMode() {return m_ThermalMode;};
403
404    cam_focus_mode_type getFocusMode() const {return mFocusMode;};
405    int32_t setNumOfSnapshot();
406    int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange);
407    bool isJpegPictureFormat() {return (mPictureFormat == CAM_FORMAT_JPEG);};
408    cam_denoise_process_type_t getWaveletDenoiseProcessPlate();
409    int32_t getLiveSnapshotSize(cam_dimension_t &dim) {dim = m_LiveSnapshotSize; return NO_ERROR;};
410    int getFlipMode(cam_stream_type_t streamType);
411
412    void setLockCAFNeeded(bool bNeedflag) {m_bNeedLockCAF = bNeedflag;};
413    bool isLockCAFNeeded() {return m_bNeedLockCAF;};
414    bool isCAFLocked() {return m_bCAFLocked;};
415    void setAFRunning(bool bflag) {m_bAFRunning = bflag;};
416    bool isAFRunning() {return m_bAFRunning;};
417
418private:
419    int32_t setPreviewSize(const QCameraParameters& );
420    int32_t setVideoSize(const QCameraParameters& );
421    int32_t setPictureSize(const QCameraParameters& );
422    int32_t setLiveSnapshotSize(const QCameraParameters& );
423    int32_t setPreviewFormat(const QCameraParameters& );
424    int32_t setPictureFormat(const QCameraParameters& );
425    int32_t setOrientation(const QCameraParameters& );
426    int32_t setJpegThumbnailSize(const QCameraParameters& );
427    int32_t setJpegQuality(const QCameraParameters& );
428    int32_t setPreviewFpsRange(const QCameraParameters& );
429    int32_t setPreviewFrameRate(const QCameraParameters& );
430    int32_t setAutoExposure(const QCameraParameters& );
431    int32_t setEffect(const QCameraParameters& );
432    int32_t setBrightness(const QCameraParameters& );
433    int32_t setFocusMode(const QCameraParameters& );
434    int32_t setSharpness(const QCameraParameters& );
435    int32_t setSaturation(const QCameraParameters& );
436    int32_t setContrast(const QCameraParameters& );
437    int32_t setSkinToneEnhancement(const QCameraParameters& );
438    int32_t setSceneDetect(const QCameraParameters& );
439    int32_t setZoom(const QCameraParameters& );
440    int32_t setISOValue(const QCameraParameters& );
441    int32_t setRotation(const QCameraParameters& );
442    int32_t setFlash(const QCameraParameters& );
443    int32_t setAecLock(const QCameraParameters& );
444    int32_t setAwbLock(const QCameraParameters& );
445    int32_t setMCEValue(const QCameraParameters& );
446    int32_t setDISValue(const QCameraParameters& params);
447    int32_t setHighFrameRate(const QCameraParameters& );
448    int32_t setLensShadeValue(const QCameraParameters& );
449    int32_t setExposureCompensation(const QCameraParameters& );
450    int32_t setWhiteBalance(const QCameraParameters& );
451    int32_t setAntibanding(const QCameraParameters& );
452    int32_t setFocusAreas(const QCameraParameters& );
453    int32_t setMeteringAreas(const QCameraParameters& );
454    int32_t setSceneMode(const QCameraParameters& );
455    int32_t setSelectableZoneAf(const QCameraParameters& );
456    int32_t setAEBracket(const QCameraParameters& );
457    int32_t setRedeyeReduction(const QCameraParameters& );
458    int32_t setGpsLocation(const QCameraParameters& );
459    int32_t setRecordingHint(const QCameraParameters& );
460    int32_t setNoDisplayMode(const QCameraParameters& );
461    int32_t setWaveletDenoise(const QCameraParameters& );
462    int32_t setZslMode(const QCameraParameters& );
463    int32_t setZslAttributes(const QCameraParameters& );
464    int32_t setCameraMode(const QCameraParameters& );
465    int32_t setFaceRecognition(const QCameraParameters& );
466    int32_t setFlip(const QCameraParameters& );
467
468    int32_t setAutoExposure(const char *autoExp);
469    int32_t setPreviewFpsRange(int minFPS,int maxFPS);
470    int32_t setEffect(const char *effect);
471    int32_t setBrightness(int brightness);
472    int32_t setFocusMode(const char *focusMode);
473    int32_t setSharpness(int sharpness);
474    int32_t setSaturation(int saturation);
475    int32_t setContrast(int contrast);
476    int32_t setSkinToneEnhancement(int sceFactor);
477    int32_t setSceneDetect(const char *scendDetect);
478    int32_t setZoom(int zoom_level);
479    int32_t setISOValue(const char *isoValue);
480    int32_t setFlash(const char *flashStr);
481    int32_t setAecLock(const char *aecStr);
482    int32_t setAwbLock(const char *awbStr);
483    int32_t setMCEValue(const char *mceStr);
484    int32_t setDISValue(const char *disStr);
485    int32_t setHighFrameRate(const char *hfrStr);
486    int32_t setLensShadeValue(const char *lensShadeStr);
487    int32_t setExposureCompensation(int expComp);
488    int32_t setWhiteBalance(const char *wbStr);
489    int32_t setAntibanding(const char *antiBandingStr);
490    int32_t setFocusAreas(const char *focusAreasStr);
491    int32_t setMeteringAreas(const char *meteringAreasStr);
492    int32_t setSceneMode(const char *sceneModeStr);
493    int32_t setSelectableZoneAf(const char *selZoneAFStr);
494    int32_t setAEBracket(const char *aecBracketStr);
495    int32_t setRedeyeReduction(const char *redeyeStr);
496    int32_t setWaveletDenoise(const char *wnrStr);
497    int32_t setFaceRecognition(const char *faceRecog, int maxFaces);
498
499    int32_t parse_pair(const char *str, int *first, int *second,
500                       char delim, char **endptr);
501    void parseSizesList(const char *sizesStr, Vector<Size> &sizes);
502    int32_t parseNDimVector(const char *str, int *num, int N, char delim);
503    int32_t parseCameraAreaString(const char *str, int max_num_areas,
504                                  cam_area_t *pAreas, int& num_areas_found);
505    bool validateCameraAreas(cam_area_t *areas, int num_areas);
506    int parseGPSCoordinate(const char *coord_str, rat_t *coord);
507    int32_t getRational(rat_t *rat, int num, int denom);
508    String8 createSizesString(const cam_dimension_t *sizes, int len);
509    String8 createValuesString(const int *values, int len,
510                               const QCameraMap *map, int map_len);
511    String8 createValuesStringFromMap(const QCameraMap *map,
512                                      int map_len);
513    String8 createHfrValuesString(const cam_hfr_info_t *values, int len,
514                                  const QCameraMap *map, int map_len);
515    String8 createHfrSizesString(const cam_hfr_info_t *values, int len);
516    String8 createFpsRangeString(const cam_fps_range_t *fps,
517                                 int len,
518                                 int &default_fps_index);
519    String8 createFpsString(const cam_fps_range_t *fps, int len);
520    String8 createZoomRatioValuesString(int *zoomRatios, int length);
521    int lookupAttr(const QCameraMap arr[], int len, const char *name);
522    const char *lookupNameByValue(const QCameraMap arr[], int len, int value);
523
524    // ops for batch set/get params with server
525    int32_t initBatchUpdate(parm_buffer_t *p_table);
526    int32_t AddSetParmEntryToBatch(parm_buffer_t *p_table,
527                                   cam_intf_parm_type_t paramType,
528                                   uint32_t paramLength,
529                                   void *paramValue);
530    int32_t commitSetBatch();
531    int32_t AddGetParmEntryToBatch(parm_buffer_t *p_table,
532                                   cam_intf_parm_type_t paramType);
533    int32_t commitGetBatch();
534
535    // ops to tempororily update parameter entries and commit
536    int32_t updateParamEntry(const char *key, const char *value);
537    int32_t commitParamChanges();
538
539    // Map from strings to values
540    static const cam_dimension_t THUMBNAIL_SIZES_MAP[];
541    static const QCameraMap AUTO_EXPOSURE_MAP[];
542    static const QCameraMap PREVIEW_FORMATS_MAP[];
543    static const QCameraMap PICTURE_TYPES_MAP[];
544    static const QCameraMap RAW_FORMATS_MAP[];
545    static const QCameraMap FOCUS_MODES_MAP[];
546    static const QCameraMap EFFECT_MODES_MAP[];
547    static const QCameraMap SCENE_MODES_MAP[];
548    static const QCameraMap FLASH_MODES_MAP[];
549    static const QCameraMap FOCUS_ALGO_MAP[];
550    static const QCameraMap WHITE_BALANCE_MODES_MAP[];
551    static const QCameraMap ANTIBANDING_MODES_MAP[];
552    static const QCameraMap ISO_MODES_MAP[];
553    static const QCameraMap HFR_MODES_MAP[];
554    static const QCameraMap BRACKETING_MODES_MAP[];
555    static const QCameraMap ON_OFF_MODES_MAP[];
556    static const QCameraMap ENABLE_DISABLE_MODES_MAP[];
557    static const QCameraMap DENOISE_ON_OFF_MODES_MAP[];
558    static const QCameraMap TRUE_FALSE_MODES_MAP[];
559    static const QCameraMap TOUCH_AF_AEC_MODES_MAP[];
560    static const QCameraMap FLIP_MODES_MAP[];
561
562    cam_capability_t *m_pCapability;
563    mm_camera_vtbl_t *m_pCamOpsTbl;
564    QCameraHeapMemory *m_pParamHeap;
565    parm_buffer_t     *m_pParamBuf;  // ptr to param buf in m_pParamHeap
566
567    bool m_bZslMode;                // if ZSL is enabled
568    bool m_bRecordingHint;          // local copy of recording hint
569    bool m_bHistogramEnabled;       // if histogram is enabled
570    int  m_nFaceProcMask;           // face process mask
571    bool m_bDebugFps;               // if FPS need to be logged
572    cam_focus_mode_type mFocusMode;
573    cam_format_t mPreviewFormat;
574    int32_t mPictureFormat;         // could be CAMERA_PICTURE_TYPE_JPEG or cam_format_t
575    bool m_bNeedRestart;            // if preview needs restart after parameters updated
576    bool m_bNoDisplayMode;
577    bool m_bWNROn;
578    bool m_bNeedLockCAF;
579    bool m_bCAFLocked;
580    bool m_bAFRunning;
581    qcamera_thermal_mode m_ThermalMode; // adjust fps vs adjust frameskip
582    cam_dimension_t m_LiveSnapshotSize; // live snapshot size
583
584    DefaultKeyedVector<String8,String8> m_tempMap; // map for temororily store parameters to be set
585};
586
587}; // namespace qcamera
588
589#endif
590