1 /* Copyright (c) 2015-2017, 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, uint32_t cam_type = MM_CAMERA_TYPE_MAIN); 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 cam_stream_type_t getSecureStreamType(); 109 bool isNoDisplayMode(); 110 bool isWNREnabled(); 111 bool isTNRSnapshotEnabled(); 112 int32_t getCDSMode(); 113 bool isLTMForSeeMoreEnabled(); 114 bool isHfrMode(); 115 void getHfrFps(cam_fps_range_t &pFpsRange); 116 uint8_t getNumOfSnapshots(); 117 uint8_t getNumOfRetroSnapshots(); 118 uint8_t getNumOfExtraHDRInBufsIfNeeded(); 119 uint8_t getNumOfExtraHDROutBufsIfNeeded(); 120 121 bool getRecordingHintValue(); 122 uint32_t getJpegQuality(); 123 uint32_t getRotation(); 124 uint32_t getDeviceRotation(); 125 uint32_t getJpegExifRotation(); 126 bool useJpegExifRotation(); 127 int32_t getEffectValue(); 128 bool isInstantAECEnabled(); 129 bool isInstantCaptureEnabled(); 130 uint8_t getAecFrameBoundValue(); 131 uint8_t getAecSkipDisplayFrameBound(); 132 133 int32_t getExifDateTime(String8 &dateTime, String8 &subsecTime); 134 int32_t getExifFocalLength(rat_t *focalLenght); 135 uint16_t getExifIsoSpeed(); 136 int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, 137 uint32_t &count); 138 int32_t getExifLatitude(rat_t *latitude, char *latRef); 139 int32_t getExifLongitude(rat_t *longitude, char *lonRef); 140 int32_t getExifAltitude(rat_t *altitude, char *altRef); 141 int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, 142 uint32_t bufLen, rat_t *gpsTimeStamp); 143 bool isVideoBuffersCached(); 144 int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances); 145 146 bool isAEBracketEnabled(); 147 int32_t setAEBracketing(); 148 bool isFpsDebugEnabled(); 149 bool isHistogramEnabled(); 150 bool isSceneSelectionEnabled(); 151 bool isSmallJpegSizeEnabled(); 152 int32_t setSelectedScene(cam_scene_mode_type scene); 153 cam_scene_mode_type getSelectedScene(); 154 bool isFaceDetectionEnabled(); 155 int32_t setFaceDetectionOption(bool enabled); 156 int32_t setHistogram(bool enabled); 157 int32_t setFaceDetection(bool enabled, bool initCommit); 158 int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern); 159 qcamera_thermal_mode getThermalMode(); 160 int32_t updateRecordingHintValue(int32_t value); 161 int32_t setHDRAEBracket(cam_exp_bracketing_t hdrBracket); 162 bool isHDREnabled(); 163 bool isAutoHDREnabled(); 164 int32_t stopAEBracket(); 165 int32_t updateRAW(cam_dimension_t max_dim); 166 bool isDISEnabled(); 167 bool isAVTimerEnabled(); 168 int32_t setISType(); 169 cam_is_type_t getVideoISType(); 170 cam_is_type_t getPreviewISType(); 171 uint8_t getMobicatMask(); 172 173 cam_focus_mode_type getFocusMode() const; 174 int32_t setNumOfSnapshot(); 175 int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange); 176 bool isJpegPictureFormat(); 177 bool isNV16PictureFormat(); 178 bool isNV21PictureFormat(); 179 cam_denoise_process_type_t getDenoiseProcessPlate(cam_intf_parm_type_t type); 180 int32_t getMaxPicSize(cam_dimension_t &dim); 181 int getFlipMode(cam_stream_type_t streamType); 182 bool isSnapshotFDNeeded(); 183 184 bool isHDR1xFrameEnabled(); 185 bool isYUVFrameInfoNeeded(); 186 const char*getFrameFmtString(cam_format_t fmt); 187 bool isHDR1xExtraBufferNeeded(); 188 bool isHDROutputCropEnabled(); 189 190 bool isPreviewFlipChanged(); 191 bool isVideoFlipChanged(); 192 bool isSnapshotFlipChanged(); 193 bool isZoomChanged(); 194 void setHDRSceneEnable(bool bflag); 195 int32_t updateAWBParams(cam_awb_params_t &awb_params); 196 197 const char *getASDStateString(cam_auto_scene_t scene); 198 bool isHDRThumbnailProcessNeeded(); 199 void setMinPpMask(cam_feature_mask_t min_pp_mask); 200 bool setStreamConfigure(bool isCapture, 201 bool previewAsPostview, bool resetConfig); 202 int32_t addOnlineRotation(uint32_t rotation, uint32_t streamId, 203 int32_t device_rotation); 204 uint8_t getNumOfExtraBuffersForImageProc(); 205 uint8_t getNumOfExtraBuffersForVideo(); 206 uint8_t getNumOfExtraBuffersForPreview(); 207 uint32_t getExifBufIndex(uint32_t captureIndex); 208 bool needThumbnailReprocess(cam_feature_mask_t *pFeatureMask); 209 bool isUbiFocusEnabled(); 210 bool isChromaFlashEnabled(); 211 bool isHighQualityNoiseReductionMode(); 212 bool isTruePortraitEnabled(); 213 size_t getTPMaxMetaSize(); 214 bool isSeeMoreEnabled(); 215 bool isStillMoreEnabled(); 216 bool isOptiZoomEnabled(); 217 218 int32_t commitAFBracket(cam_af_bracketing_t afBracket); 219 int32_t set3ALock(bool lock3A); 220 int32_t setAndCommitZoom(int zoom_level); 221 uint8_t getBurstCountForAdvancedCapture(); 222 uint32_t getNumberInBufsForSingleShot(); 223 uint32_t getNumberOutBufsForSingleShot(); 224 int32_t setLongshotEnable(bool enable); 225 String8 dump(); 226 bool isUbiRefocus(); 227 uint32_t getRefocusMaxMetaSize(); 228 uint8_t getRefocusOutputCount(); 229 bool generateThumbFromMain(); 230 void updateCurrentFocusPosition(cam_focus_pos_info_t &cur_pos_info); 231 void updateAEInfo(cam_3a_params_t &ae_params); 232 bool isDisplayFrameNeeded(); 233 bool isAdvCamFeaturesEnabled(); 234 int32_t setAecLock(const char *aecStr); 235 int32_t updateDebugLevel(); 236 bool is4k2kVideoResolution(); 237 bool isUBWCEnabled(); 238 239 int getBrightness(); 240 int32_t updateOisValue(bool oisValue); 241 int32_t setIntEvent(cam_int_evt_params_t params); 242 bool getofflineRAW(); 243 bool getQuadraCfa(); 244 int32_t updatePpFeatureMask(cam_stream_type_t stream_type); 245 int32_t getStreamPpMask(cam_stream_type_t stream_type, cam_feature_mask_t &pp_mask); 246 int32_t getSharpness(); 247 int32_t getEffect(); 248 int32_t updateFlashMode(cam_flash_mode_t flash_mode); 249 int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config); 250 int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config); 251 int32_t configFrameCapture(bool commitSettings); 252 int32_t resetFrameCapture(bool commitSettings, bool lowLightEnabled); 253 cam_still_more_t getStillMoreSettings(); 254 void setStillMoreSettings(cam_still_more_t stillmore_config); 255 cam_still_more_t getStillMoreCapability(); 256 cam_dyn_img_data_t getDynamicImgData(); 257 void setDynamicImgData(cam_dyn_img_data_t d); 258 259 int32_t getParmZoomLevel(); 260 int8_t getReprocCount(); 261 int8_t getCurPPCount(); 262 void setReprocCount(); 263 bool isPostProcScaling(); 264 bool isLLNoiseEnabled(); 265 void setCurPPCount(int8_t count); 266 int32_t setQuadraCfaMode(uint32_t value, bool initCommit); 267 int32_t setToneMapMode(uint32_t value, bool initCommit); 268 void setTintless(bool enable); 269 uint8_t getLongshotStages(); 270 int8_t getBufBatchCount(); 271 int8_t getVideoBatchSize(); 272 273 int32_t setManualCaptureMode( 274 QCameraManualCaptureModes value = CAM_MANUAL_CAPTURE_TYPE_OFF); 275 QCameraManualCaptureModes getManualCaptureMode(); 276 int64_t getExposureTime(); 277 278 cam_capture_frame_config_t getCaptureFrameConfig(); 279 void setJpegRotation(int rotation); 280 uint32_t getJpegRotation(); 281 282 void setLowLightLevel(cam_low_light_mode_t value); 283 cam_low_light_mode_t getLowLightLevel(); 284 bool getLowLightCapture(); 285 bool isLinkPreviewForLiveShot(); 286 287 /* Dual camera specific */ 288 bool getDcrf(); 289 int32_t setRelatedCamSyncInfo( 290 cam_sync_related_sensors_event_info_t* info); 291 const cam_sync_related_sensors_event_info_t* 292 getRelatedCamSyncInfo(void); 293 int32_t setFrameSyncEnabled(bool enable); 294 bool isFrameSyncEnabled(void); 295 int32_t getRelatedCamCalibration( 296 cam_related_system_calibration_data_t* calib); 297 int32_t bundleRelatedCameras(bool sync); 298 uint8_t fdModeInVideo(); 299 bool isOEMFeatEnabled(); 300 uint8_t isOEMFeatFrameSkipEnabled(); 301 302 int32_t setZslMode(bool value); 303 int32_t updateZSLModeValue(bool value); 304 305 bool isReprocScaleEnabled(); 306 bool isUnderReprocScaling(); 307 int32_t getPicSizeFromAPK(int &width, int &height); 308 309 int32_t checkFeatureConcurrency(); 310 int32_t setInstantAEC(uint8_t enable, bool initCommit); 311 312 int32_t getAnalysisInfo( 313 bool fdVideoEnabled, 314 cam_feature_mask_t featureMask, 315 cam_analysis_info_t *pAnalysisInfo); 316 int32_t updateDtVc(int32_t *dt, int32_t *vc); 317 int32_t SetDualCamera(bool value); 318 int32_t setCameraControls(int32_t controls); 319 int32_t setSwitchCamera(uint32_t camMaster); 320 int32_t setDeferCamera(cam_dual_camera_defer_cmd_t type); 321 void setBundledSnapshot(bool value); 322 int32_t getDualLedCalibration(); 323 bool isDCmAsymmetricSnapMode(); 324 private: 325 QCameraParameters *mImpl; 326 mutable Mutex mLock; 327 }; 328 329 }; // namespace qcamera 330 331 #endif 332