• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
32 extern "C" {
33 #include <mm_jpeg_interface.h>
34 }
35 
36 using namespace android;
37 
38 namespace qcamera {
39 
40 //EXIF globals
41 static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };          // "ASCII\0\0\0"
42 static 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 
48 class QCameraParameters: public CameraParameters
49 {
50 public:
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     static const char KEY_QC_VIDEO_HDR[];
293     static const char KEY_QC_SUPPORTED_VIDEO_HDR_MODES[];
294 
295     // Values for SKIN TONE ENHANCEMENT
296     static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ;
297     static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ;
298 
299     // Values for Denoise
300     static const char DENOISE_OFF[] ;
301     static const char DENOISE_ON[] ;
302 
303     // Values for auto exposure settings.
304     static const char FOCUS_ALGO_AUTO[];
305     static const char FOCUS_ALGO_SPOT_METERING[];
306     static const char FOCUS_ALGO_CENTER_WEIGHTED[];
307     static const char FOCUS_ALGO_FRAME_AVERAGE[];
308 
309     // Values for AE Bracketing settings.
310     static const char AE_BRACKET_OFF[];
311     static const char AE_BRACKET[];
312 
313     // Values for HFR settings.
314     static const char VIDEO_HFR_OFF[];
315     static const char VIDEO_HFR_2X[];
316     static const char VIDEO_HFR_3X[];
317     static const char VIDEO_HFR_4X[];
318     static const char VIDEO_HFR_5X[];
319 
320     // Values for feature on/off settings.
321     static const char VALUE_OFF[];
322     static const char VALUE_ON[];
323 
324     // Values for feature enable/disable settings.
325     static const char VALUE_ENABLE[];
326     static const char VALUE_DISABLE[];
327 
328     // Values for feature true/false settings.
329     static const char VALUE_FALSE[];
330     static const char VALUE_TRUE[];
331 
332     //Values for flip settings
333     static const char FLIP_MODE_OFF[];
334     static const char FLIP_MODE_V[];
335     static const char FLIP_MODE_H[];
336     static const char FLIP_MODE_VH[];
337 
338     enum {
339         CAMERA_ORIENTATION_UNKNOWN = 0,
340         CAMERA_ORIENTATION_PORTRAIT = 1,
341         CAMERA_ORIENTATION_LANDSCAPE = 2,
342     };
343     typedef struct {
344         const char *const desc;
345         int val;
346     } QCameraMap;
347 
348     void getSupportedHfrSizes(Vector<Size> &sizes);
349     void setPreviewFrameRateMode(const char *mode);
350     const char *getPreviewFrameRateMode() const;
351     void setTouchIndexAec(int x, int y);
352     void getTouchIndexAec(int *x, int *y);
353     void setTouchIndexAf(int x, int y);
354     void getTouchIndexAf(int *x, int *y);
355 
356     int32_t init(cam_capability_t *, mm_camera_vtbl_t *);
357     void deinit();
358     int32_t assign(QCameraParameters& params);
359     int32_t initDefaultParameters();
360     int32_t updateParameters(QCameraParameters&, bool &needRestart);
361     int32_t commitParameters();
362     int getPreviewHalPixelFormat() const;
363     int32_t getStreamFormat(cam_stream_type_t streamType,
364                              cam_format_t &format);
365     int32_t getStreamDimension(cam_stream_type_t streamType,
366                                 cam_dimension_t &dim);
367     void getThumbnailSize(int *width, int *height) const;
368 
369     int getZSLBurstInterval();
370     int getZSLQueueDepth();
371     int getZSLBackLookCount();
372     int getMaxUnmatchedFramesInQueue();
isZSLMode()373     bool isZSLMode() {return m_bZslMode;};
isNoDisplayMode()374     bool isNoDisplayMode() {return m_bNoDisplayMode;};
isWNREnabled()375     bool isWNREnabled() {return m_bWNROn;};
376     uint8_t getNumOfSnapshots();
377     uint8_t getNumOfExtraHDRBufsIfNeeded();
378     uint8_t getNumOfHDRBufsIfNeeded();
379     int getBurstNum();
getRecordingHintValue()380     bool getRecordingHintValue() {return m_bRecordingHint;}; // return local copy of video hint
381     int setRecordingHintValue(int32_t value); // set local copy of video hint and send to server
382                                               // no change in parameters value
383     int getJpegQuality();
384     int getJpegRotation();
385 
386     int32_t getExifDateTime(char *dateTime, uint32_t &count);
387     int32_t getExifFocalLength(rat_t *focalLenght);
388     uint16_t getExifIsoSpeed();
389     int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, uint32_t &count);
390     int32_t getExifLatitude(rat_t *latitude, char *latRef);
391     int32_t getExifLongitude(rat_t *longitude, char *lonRef);
392     int32_t getExifAltitude(rat_t *altitude, char *altRef);
393     int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, uint32_t bufLen, rat_t *gpsTimeStamp);
394     int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances);
395 
isFpsDebugEnabled()396     bool isFpsDebugEnabled() {return m_bDebugFps;};
isHistogramEnabled()397     bool isHistogramEnabled() {return m_bHistogramEnabled;};
isFaceDetectionEnabled()398     bool isFaceDetectionEnabled() {return ((m_nFaceProcMask & CAM_FACE_PROCESS_MASK_DETECTION) != 0);};
399     int32_t setHistogram(bool enabled);
400     int32_t setFaceDetection(bool enabled);
401     int32_t setLockCAF(bool bLock);
402     int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern);
getThermalMode()403     qcamera_thermal_mode getThermalMode() {return m_ThermalMode;};
404     int32_t updateRecordingHintValue(int32_t value);
405 
getFocusMode()406     cam_focus_mode_type getFocusMode() const {return mFocusMode;};
407     int32_t setNumOfSnapshot();
408     int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange);
isJpegPictureFormat()409     bool isJpegPictureFormat() {return (mPictureFormat == CAM_FORMAT_JPEG);};
isNV16PictureFormat()410     bool isNV16PictureFormat() {return (mPictureFormat == CAM_FORMAT_YUV_422_NV16);};
411     cam_denoise_process_type_t getWaveletDenoiseProcessPlate();
getLiveSnapshotSize(cam_dimension_t & dim)412     int32_t getLiveSnapshotSize(cam_dimension_t &dim) {dim = m_LiveSnapshotSize; return NO_ERROR;};
413     int getFlipMode(cam_stream_type_t streamType);
414 
setLockCAFNeeded(bool bNeedflag)415     void setLockCAFNeeded(bool bNeedflag) {m_bNeedLockCAF = bNeedflag;};
isLockCAFNeeded()416     bool isLockCAFNeeded() {return m_bNeedLockCAF;};
isCAFLocked()417     bool isCAFLocked() {return m_bCAFLocked;};
setAFRunning(bool bflag)418     void setAFRunning(bool bflag) {m_bAFRunning = bflag;};
isAFRunning()419     bool isAFRunning() {return m_bAFRunning;};
420 
421 private:
422     int32_t setPreviewSize(const QCameraParameters& );
423     int32_t setVideoSize(const QCameraParameters& );
424     int32_t setPictureSize(const QCameraParameters& );
425     int32_t setLiveSnapshotSize(const QCameraParameters& );
426     int32_t setPreviewFormat(const QCameraParameters& );
427     int32_t setPictureFormat(const QCameraParameters& );
428     int32_t setOrientation(const QCameraParameters& );
429     int32_t setJpegThumbnailSize(const QCameraParameters& );
430     int32_t setJpegQuality(const QCameraParameters& );
431     int32_t setPreviewFpsRange(const QCameraParameters& );
432     int32_t setPreviewFrameRate(const QCameraParameters& );
433     int32_t setAutoExposure(const QCameraParameters& );
434     int32_t setEffect(const QCameraParameters& );
435     int32_t setBrightness(const QCameraParameters& );
436     int32_t setFocusMode(const QCameraParameters& );
437     int32_t setSharpness(const QCameraParameters& );
438     int32_t setSaturation(const QCameraParameters& );
439     int32_t setContrast(const QCameraParameters& );
440     int32_t setSkinToneEnhancement(const QCameraParameters& );
441     int32_t setSceneDetect(const QCameraParameters& );
442     int32_t setVideoHDR(const QCameraParameters& );
443     int32_t setZoom(const QCameraParameters& );
444     int32_t setISOValue(const QCameraParameters& );
445     int32_t setRotation(const QCameraParameters& );
446     int32_t setFlash(const QCameraParameters& );
447     int32_t setAecLock(const QCameraParameters& );
448     int32_t setAwbLock(const QCameraParameters& );
449     int32_t setMCEValue(const QCameraParameters& );
450     int32_t setDISValue(const QCameraParameters& params);
451     int32_t setHighFrameRate(const QCameraParameters& );
452     int32_t setLensShadeValue(const QCameraParameters& );
453     int32_t setExposureCompensation(const QCameraParameters& );
454     int32_t setWhiteBalance(const QCameraParameters& );
455     int32_t setAntibanding(const QCameraParameters& );
456     int32_t setFocusAreas(const QCameraParameters& );
457     int32_t setMeteringAreas(const QCameraParameters& );
458     int32_t setSceneMode(const QCameraParameters& );
459     int32_t setSelectableZoneAf(const QCameraParameters& );
460     int32_t setAEBracket(const QCameraParameters& );
461     int32_t setRedeyeReduction(const QCameraParameters& );
462     int32_t setGpsLocation(const QCameraParameters& );
463     int32_t setRecordingHint(const QCameraParameters& );
464     int32_t setNoDisplayMode(const QCameraParameters& );
465     int32_t setWaveletDenoise(const QCameraParameters& );
466     int32_t setZslMode(const QCameraParameters& );
467     int32_t setZslAttributes(const QCameraParameters& );
468     int32_t setCameraMode(const QCameraParameters& );
469     int32_t setFaceRecognition(const QCameraParameters& );
470     int32_t setFlip(const QCameraParameters& );
471 
472     int32_t setAutoExposure(const char *autoExp);
473     int32_t setPreviewFpsRange(int minFPS,int maxFPS);
474     int32_t setEffect(const char *effect);
475     int32_t setBrightness(int brightness);
476     int32_t setFocusMode(const char *focusMode);
477     int32_t setSharpness(int sharpness);
478     int32_t setSaturation(int saturation);
479     int32_t setContrast(int contrast);
480     int32_t setSkinToneEnhancement(int sceFactor);
481     int32_t setSceneDetect(const char *scendDetect);
482     int32_t setVideoHDR(const char *videoHDR);
483     int32_t setZoom(int zoom_level);
484     int32_t setISOValue(const char *isoValue);
485     int32_t setFlash(const char *flashStr);
486     int32_t setAecLock(const char *aecStr);
487     int32_t setAwbLock(const char *awbStr);
488     int32_t setMCEValue(const char *mceStr);
489     int32_t setDISValue(const char *disStr);
490     int32_t setHighFrameRate(const char *hfrStr);
491     int32_t setLensShadeValue(const char *lensShadeStr);
492     int32_t setExposureCompensation(int expComp);
493     int32_t setWhiteBalance(const char *wbStr);
494     int32_t setAntibanding(const char *antiBandingStr);
495     int32_t setFocusAreas(const char *focusAreasStr);
496     int32_t setMeteringAreas(const char *meteringAreasStr);
497     int32_t setSceneMode(const char *sceneModeStr);
498     int32_t setSelectableZoneAf(const char *selZoneAFStr);
499     int32_t setAEBracket(const char *aecBracketStr);
500     int32_t setRedeyeReduction(const char *redeyeStr);
501     int32_t setWaveletDenoise(const char *wnrStr);
502     int32_t setFaceRecognition(const char *faceRecog, int maxFaces);
503 
504     int32_t parse_pair(const char *str, int *first, int *second,
505                        char delim, char **endptr);
506     void parseSizesList(const char *sizesStr, Vector<Size> &sizes);
507     int32_t parseNDimVector(const char *str, int *num, int N, char delim);
508     int32_t parseCameraAreaString(const char *str, int max_num_areas,
509                                   cam_area_t *pAreas, int& num_areas_found);
510     bool validateCameraAreas(cam_area_t *areas, int num_areas);
511     int parseGPSCoordinate(const char *coord_str, rat_t *coord);
512     int32_t getRational(rat_t *rat, int num, int denom);
513     String8 createSizesString(const cam_dimension_t *sizes, int len);
514     String8 createValuesString(const int *values, int len,
515                                const QCameraMap *map, int map_len);
516     String8 createValuesStringFromMap(const QCameraMap *map,
517                                       int map_len);
518     String8 createHfrValuesString(const cam_hfr_info_t *values, int len,
519                                   const QCameraMap *map, int map_len);
520     String8 createHfrSizesString(const cam_hfr_info_t *values, int len);
521     String8 createFpsRangeString(const cam_fps_range_t *fps,
522                                  int len,
523                                  int &default_fps_index);
524     static int compareFPSValues(const void *p1, const void *p2);
525     String8 createFpsString(const cam_fps_range_t *fps, int len);
526     String8 createZoomRatioValuesString(int *zoomRatios, int length);
527     int lookupAttr(const QCameraMap arr[], int len, const char *name);
528     const char *lookupNameByValue(const QCameraMap arr[], int len, int value);
529 
530     // ops for batch set/get params with server
531     int32_t initBatchUpdate(parm_buffer_t *p_table);
532     int32_t AddSetParmEntryToBatch(parm_buffer_t *p_table,
533                                    cam_intf_parm_type_t paramType,
534                                    uint32_t paramLength,
535                                    void *paramValue);
536     int32_t commitSetBatch();
537     int32_t AddGetParmEntryToBatch(parm_buffer_t *p_table,
538                                    cam_intf_parm_type_t paramType);
539     int32_t commitGetBatch();
540 
541     // ops to tempororily update parameter entries and commit
542     int32_t updateParamEntry(const char *key, const char *value);
543     int32_t commitParamChanges();
544 
545     // Map from strings to values
546     static const cam_dimension_t THUMBNAIL_SIZES_MAP[];
547     static const QCameraMap AUTO_EXPOSURE_MAP[];
548     static const QCameraMap PREVIEW_FORMATS_MAP[];
549     static const QCameraMap PICTURE_TYPES_MAP[];
550     static const QCameraMap RAW_FORMATS_MAP[];
551     static const QCameraMap FOCUS_MODES_MAP[];
552     static const QCameraMap EFFECT_MODES_MAP[];
553     static const QCameraMap SCENE_MODES_MAP[];
554     static const QCameraMap FLASH_MODES_MAP[];
555     static const QCameraMap FOCUS_ALGO_MAP[];
556     static const QCameraMap WHITE_BALANCE_MODES_MAP[];
557     static const QCameraMap ANTIBANDING_MODES_MAP[];
558     static const QCameraMap ISO_MODES_MAP[];
559     static const QCameraMap HFR_MODES_MAP[];
560     static const QCameraMap BRACKETING_MODES_MAP[];
561     static const QCameraMap ON_OFF_MODES_MAP[];
562     static const QCameraMap ENABLE_DISABLE_MODES_MAP[];
563     static const QCameraMap DENOISE_ON_OFF_MODES_MAP[];
564     static const QCameraMap TRUE_FALSE_MODES_MAP[];
565     static const QCameraMap TOUCH_AF_AEC_MODES_MAP[];
566     static const QCameraMap FLIP_MODES_MAP[];
567 
568     cam_capability_t *m_pCapability;
569     mm_camera_vtbl_t *m_pCamOpsTbl;
570     QCameraHeapMemory *m_pParamHeap;
571     parm_buffer_t     *m_pParamBuf;  // ptr to param buf in m_pParamHeap
572 
573     bool m_bZslMode;                // if ZSL is enabled
574     bool m_bZslMode_new;
575     bool m_bRecordingHint;          // local copy of recording hint
576     bool m_bRecordingHint_new;
577     bool m_bHistogramEnabled;       // if histogram is enabled
578     int  m_nFaceProcMask;           // face process mask
579     bool m_bDebugFps;               // if FPS need to be logged
580     cam_focus_mode_type mFocusMode;
581     cam_format_t mPreviewFormat;
582     int32_t mPictureFormat;         // could be CAMERA_PICTURE_TYPE_JPEG or cam_format_t
583     bool m_bNeedRestart;            // if preview needs restart after parameters updated
584     bool m_bNoDisplayMode;
585     bool m_bWNROn;
586     bool m_bNeedLockCAF;
587     bool m_bCAFLocked;
588     bool m_bAFRunning;
589     qcamera_thermal_mode m_ThermalMode; // adjust fps vs adjust frameskip
590     cam_dimension_t m_LiveSnapshotSize; // live snapshot size
591 
592     DefaultKeyedVector<String8,String8> m_tempMap; // map for temororily store parameters to be set
593 };
594 
595 }; // namespace qcamera
596 
597 #endif
598