• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef ANDROID_HARDWARE_QCAMERA_PARAMETERS_INTF_H
31 #define ANDROID_HARDWARE_QCAMERA_PARAMETERS_INTF_H
32 
33 #include <utils/String8.h>
34 #include <utils/Mutex.h>
35 #include "cam_intf.h"
36 #include "cam_types.h"
37 #include "QCameraThermalAdapter.h"
38 #include "QCameraFOVControl.h"
39 
40 extern "C" {
41 #include <mm_camera_interface.h>
42 #include <mm_jpeg_interface.h>
43 }
44 
45 using namespace android;
46 
47 namespace qcamera {
48 
49 typedef cam_manual_capture_type QCameraManualCaptureModes;
50 
51 class QCameraAdjustFPS
52 {
53 public:
54     virtual int recalcFPSRange(int &minFPS, int &maxFPS,
55             const float &minVideoFPS, const float &maxVideoFPs,
56             cam_fps_range_t &adjustedRange, bool bRecordingHint) = 0;
~QCameraAdjustFPS()57     virtual ~QCameraAdjustFPS() {}
58 };
59 
60 class QCameraParameters;
61 
62 class QCameraParametersIntf
63 {
64 public:
65 
66     // member variables
67     QCameraParametersIntf();
68     ~QCameraParametersIntf();
69 
70     int32_t allocate(uint8_t bufCount = 1);
71     int32_t init(cam_capability_t *capabilities,
72                  mm_camera_vtbl_t *mmOps,
73                  QCameraAdjustFPS *adjustFPS,
74                  QCameraFOVControl *fovControl);
75 
76     void deinit();
77     int32_t updateParameters(const String8& params, bool &needRestart);
78     int32_t commitParameters();
79 
80     char* getParameters();
81     void getPreviewFpsRange(int *min_fps, int *max_fps) const;
82 #ifdef TARGET_TS_MAKEUP
83     bool getTsMakeupInfo(int &whiteLevel, int &cleanLevel) const;
84 #endif
85 
86     int getPreviewHalPixelFormat();
87     int32_t getStreamRotation(cam_stream_type_t streamType,
88             cam_pp_feature_config_t &featureConfig,
89             cam_dimension_t &dim);
90     int32_t getStreamFormat(cam_stream_type_t streamType,
91             cam_format_t &format);
92 
93     int32_t getStreamSubFormat(
94       cam_stream_type_t streamType, cam_sub_format_type_t &sub_format);
95 
96 
97     int32_t getStreamDimension(cam_stream_type_t streamType,
98             cam_dimension_t &dim);
99 
100     void getThumbnailSize(int *width, int *height) const;
101     uint8_t getZSLBurstInterval();
102     uint8_t getZSLQueueDepth();
103     uint8_t getZSLBackLookCount();
104     uint8_t getMaxUnmatchedFramesInQueue();
105     bool isZSLMode();
106     bool isRdiMode();
107     bool isSecureMode();
108     bool isNoDisplayMode();
109     bool isWNREnabled();
110     bool isTNRSnapshotEnabled();
111     int32_t getCDSMode();
112     bool isLTMForSeeMoreEnabled();
113     bool isHfrMode();
114     void getHfrFps(cam_fps_range_t &pFpsRange);
115     uint8_t getNumOfSnapshots();
116     uint8_t getNumOfRetroSnapshots();
117     uint8_t getNumOfExtraHDRInBufsIfNeeded();
118     uint8_t getNumOfExtraHDROutBufsIfNeeded();
119 
120     bool getRecordingHintValue();
121     uint32_t getJpegQuality();
122     uint32_t getRotation();
123     uint32_t getDeviceRotation();
124     uint32_t getJpegExifRotation();
125     bool useJpegExifRotation();
126     int32_t getEffectValue();
127     bool isInstantAECEnabled();
128     bool isInstantCaptureEnabled();
129     uint8_t getAecFrameBoundValue();
130     uint8_t getAecSkipDisplayFrameBound();
131 
132     int32_t getExifDateTime(String8 &dateTime, String8 &subsecTime);
133     int32_t getExifFocalLength(rat_t *focalLenght);
134     uint16_t getExifIsoSpeed();
135     int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod,
136             uint32_t &count);
137     int32_t getExifLatitude(rat_t *latitude, char *latRef);
138     int32_t getExifLongitude(rat_t *longitude, char *lonRef);
139     int32_t getExifAltitude(rat_t *altitude, char *altRef);
140     int32_t getExifGpsDateTimeStamp(char *gpsDateStamp,
141             uint32_t bufLen, rat_t *gpsTimeStamp);
142     bool isVideoBuffersCached();
143     int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances);
144 
145     bool isAEBracketEnabled();
146     int32_t setAEBracketing();
147     bool isFpsDebugEnabled();
148     bool isHistogramEnabled();
149     bool isSceneSelectionEnabled();
150     int32_t setSelectedScene(cam_scene_mode_type scene);
151     cam_scene_mode_type getSelectedScene();
152     bool isFaceDetectionEnabled();
153     int32_t setFaceDetectionOption(bool enabled);
154     int32_t setHistogram(bool enabled);
155     int32_t setFaceDetection(bool enabled, bool initCommit);
156     int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern);
157     qcamera_thermal_mode getThermalMode();
158     int32_t updateRecordingHintValue(int32_t value);
159     int32_t setHDRAEBracket(cam_exp_bracketing_t hdrBracket);
160     bool isHDREnabled();
161     bool isAutoHDREnabled();
162     int32_t stopAEBracket();
163     int32_t updateRAW(cam_dimension_t max_dim);
164     bool isDISEnabled();
165     bool isAVTimerEnabled();
166     int32_t setISType();
167     cam_is_type_t getVideoISType();
168     cam_is_type_t getPreviewISType();
169     uint8_t getMobicatMask();
170 
171     cam_focus_mode_type getFocusMode() const;
172     int32_t setNumOfSnapshot();
173     int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange);
174     bool isJpegPictureFormat();
175     bool isNV16PictureFormat();
176     bool isNV21PictureFormat();
177     cam_denoise_process_type_t getDenoiseProcessPlate(cam_intf_parm_type_t type);
178     int32_t getMaxPicSize(cam_dimension_t &dim);
179     int getFlipMode(cam_stream_type_t streamType);
180     bool isSnapshotFDNeeded();
181 
182     bool isHDR1xFrameEnabled();
183     bool isYUVFrameInfoNeeded();
184     const char*getFrameFmtString(cam_format_t fmt);
185     bool isHDR1xExtraBufferNeeded();
186     bool isHDROutputCropEnabled();
187 
188     bool isPreviewFlipChanged();
189     bool isVideoFlipChanged();
190     bool isSnapshotFlipChanged();
191     void setHDRSceneEnable(bool bflag);
192     int32_t updateAWBParams(cam_awb_params_t &awb_params);
193 
194     const char *getASDStateString(cam_auto_scene_t scene);
195     bool isHDRThumbnailProcessNeeded();
196     void setMinPpMask(cam_feature_mask_t min_pp_mask);
197     bool setStreamConfigure(bool isCapture,
198             bool previewAsPostview, bool resetConfig);
199     int32_t addOnlineRotation(uint32_t rotation, uint32_t streamId,
200             int32_t device_rotation);
201     uint8_t getNumOfExtraBuffersForImageProc();
202     uint8_t getNumOfExtraBuffersForVideo();
203     uint8_t getNumOfExtraBuffersForPreview();
204     uint32_t getExifBufIndex(uint32_t captureIndex);
205     bool needThumbnailReprocess(cam_feature_mask_t *pFeatureMask);
206     bool isUbiFocusEnabled();
207     bool isChromaFlashEnabled();
208     bool isHighQualityNoiseReductionMode();
209     bool isTruePortraitEnabled();
210     size_t getTPMaxMetaSize();
211     bool isSeeMoreEnabled();
212     bool isStillMoreEnabled();
213     bool isOptiZoomEnabled();
214 
215     int32_t commitAFBracket(cam_af_bracketing_t afBracket);
216     int32_t set3ALock(bool lock3A);
217     int32_t setAndCommitZoom(int zoom_level);
218     uint8_t getBurstCountForAdvancedCapture();
219     uint32_t getNumberInBufsForSingleShot();
220     uint32_t getNumberOutBufsForSingleShot();
221     int32_t setLongshotEnable(bool enable);
222     String8 dump();
223     bool isUbiRefocus();
224     uint32_t getRefocusMaxMetaSize();
225     uint8_t getRefocusOutputCount();
226     bool generateThumbFromMain();
227     void updateCurrentFocusPosition(cam_focus_pos_info_t &cur_pos_info);
228     void updateAEInfo(cam_3a_params_t &ae_params);
229     bool isDisplayFrameNeeded();
230     bool isAdvCamFeaturesEnabled();
231     int32_t setAecLock(const char *aecStr);
232     int32_t updateDebugLevel();
233     bool is4k2kVideoResolution();
234     bool isUBWCEnabled();
235 
236     int getBrightness();
237     int32_t updateOisValue(bool oisValue);
238     int32_t setIntEvent(cam_int_evt_params_t params);
239     bool getofflineRAW();
240     bool getQuadraCfa();
241     int32_t updatePpFeatureMask(cam_stream_type_t stream_type);
242     int32_t getStreamPpMask(cam_stream_type_t stream_type, cam_feature_mask_t &pp_mask);
243     int32_t getSharpness();
244     int32_t getEffect();
245     int32_t updateFlashMode(cam_flash_mode_t flash_mode);
246     int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config);
247     int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config);
248     int32_t configFrameCapture(bool commitSettings);
249     int32_t resetFrameCapture(bool commitSettings, bool lowLightEnabled);
250     cam_still_more_t getStillMoreSettings();
251     void setStillMoreSettings(cam_still_more_t stillmore_config);
252     cam_still_more_t getStillMoreCapability();
253     cam_dyn_img_data_t getDynamicImgData();
254     void setDynamicImgData(cam_dyn_img_data_t d);
255 
256     int32_t getParmZoomLevel();
257     int8_t getReprocCount();
258     int8_t getCurPPCount();
259     void setReprocCount();
260     bool isPostProcScaling();
261     bool isLLNoiseEnabled();
262     void setCurPPCount(int8_t count);
263     int32_t setQuadraCfaMode(uint32_t value, bool initCommit);
264     int32_t setToneMapMode(uint32_t value, bool initCommit);
265     void setTintless(bool enable);
266     uint8_t getLongshotStages();
267     int8_t getBufBatchCount();
268     int8_t getVideoBatchSize();
269 
270     int32_t setManualCaptureMode(
271             QCameraManualCaptureModes value = CAM_MANUAL_CAPTURE_TYPE_OFF);
272     QCameraManualCaptureModes getManualCaptureMode();
273     int64_t getExposureTime();
274 
275     cam_capture_frame_config_t getCaptureFrameConfig();
276     void setJpegRotation(int rotation);
277     uint32_t getJpegRotation();
278 
279     void setLowLightLevel(cam_low_light_mode_t value);
280     cam_low_light_mode_t getLowLightLevel();
281     bool getLowLightCapture();
282 
283     /* Dual camera specific */
284     bool getDcrf();
285     int32_t setRelatedCamSyncInfo(
286             cam_sync_related_sensors_event_info_t* info);
287     const cam_sync_related_sensors_event_info_t*
288             getRelatedCamSyncInfo(void);
289     int32_t setFrameSyncEnabled(bool enable);
290     bool isFrameSyncEnabled(void);
291     int32_t getRelatedCamCalibration(
292             cam_related_system_calibration_data_t* calib);
293     int32_t bundleRelatedCameras(bool sync);
294     uint8_t fdModeInVideo();
295     bool isOEMFeatEnabled();
296 
297     int32_t setZslMode(bool value);
298     int32_t updateZSLModeValue(bool value);
299 
300     bool isReprocScaleEnabled();
301     bool isUnderReprocScaling();
302     int32_t getPicSizeFromAPK(int &width, int &height);
303 
304     int32_t checkFeatureConcurrency();
305     int32_t setInstantAEC(uint8_t enable, bool initCommit);
306 
307     int32_t getAnalysisInfo(
308         bool fdVideoEnabled,
309         bool hal3,
310         cam_feature_mask_t featureMask,
311         cam_analysis_info_t *pAnalysisInfo);
312     int32_t updateDtVc(int32_t *dt, int32_t *vc);
313     int32_t SetDualCamera(bool value);
314     int32_t setCameraControls(int32_t controls);
315     int32_t setSwitchCamera();
316 
317 private:
318     QCameraParameters *mImpl;
319     mutable Mutex mLock;
320 };
321 
322 }; // namespace qcamera
323 
324 #endif
325