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 39 extern "C" { 40 #include <mm_camera_interface.h> 41 #include <mm_jpeg_interface.h> 42 } 43 44 using namespace android; 45 46 namespace qcamera { 47 48 typedef cam_manual_capture_type QCameraManualCaptureModes; 49 50 class QCameraAdjustFPS 51 { 52 public: 53 virtual int recalcFPSRange(int &minFPS, int &maxFPS, 54 const float &minVideoFPS, const float &maxVideoFPs, 55 cam_fps_range_t &adjustedRange) = 0; 56 virtual ~QCameraAdjustFPS() {} 57 }; 58 59 class QCameraParameters; 60 61 class QCameraParametersIntf 62 { 63 public: 64 65 // member variables 66 QCameraParametersIntf(); 67 ~QCameraParametersIntf(); 68 69 int32_t allocate(uint8_t bufCount = 1); 70 int32_t init(cam_capability_t *capabilities, 71 mm_camera_vtbl_t *mmOps, 72 QCameraAdjustFPS *adjustFPS); 73 74 void deinit(); 75 int32_t updateParameters(const String8& params, bool &needRestart); 76 int32_t commitParameters(); 77 78 char* getParameters(); 79 void getPreviewFpsRange(int *min_fps, int *max_fps) const; 80 #ifdef TARGET_TS_MAKEUP 81 bool getTsMakeupInfo(int &whiteLevel, int &cleanLevel) const; 82 #endif 83 84 int getPreviewHalPixelFormat(); 85 int32_t getStreamRotation(cam_stream_type_t streamType, 86 cam_pp_feature_config_t &featureConfig, 87 cam_dimension_t &dim); 88 int32_t getStreamFormat(cam_stream_type_t streamType, 89 cam_format_t &format); 90 91 int32_t getStreamSubFormat( 92 cam_stream_type_t streamType, cam_sub_format_type_t &sub_format); 93 94 95 int32_t getStreamDimension(cam_stream_type_t streamType, 96 cam_dimension_t &dim); 97 98 void getThumbnailSize(int *width, int *height) const; 99 uint8_t getZSLBurstInterval(); 100 uint8_t getZSLQueueDepth(); 101 uint8_t getZSLBackLookCount(); 102 uint8_t getMaxUnmatchedFramesInQueue(); 103 bool isZSLMode(); 104 bool isRdiMode(); 105 bool isSecureMode(); 106 bool isNoDisplayMode(); 107 bool isWNREnabled(); 108 bool isTNRSnapshotEnabled(); 109 int32_t getCDSMode(); 110 bool isLTMForSeeMoreEnabled(); 111 bool isHfrMode(); 112 void getHfrFps(cam_fps_range_t &pFpsRange); 113 uint8_t getNumOfSnapshots(); 114 uint8_t getNumOfRetroSnapshots(); 115 uint8_t getNumOfExtraHDRInBufsIfNeeded(); 116 uint8_t getNumOfExtraHDROutBufsIfNeeded(); 117 118 bool getRecordingHintValue(); 119 uint32_t getJpegQuality(); 120 uint32_t getRotation(); 121 uint32_t getDeviceRotation(); 122 uint32_t getJpegExifRotation(); 123 bool useJpegExifRotation(); 124 int32_t getEffectValue(); 125 bool isInstantAECEnabled(); 126 bool isInstantCaptureEnabled(); 127 uint8_t getAecFrameBoundValue(); 128 uint8_t getAecSkipDisplayFrameBound(); 129 130 int32_t getExifDateTime(String8 &dateTime, String8 &subsecTime); 131 int32_t getExifFocalLength(rat_t *focalLenght); 132 uint16_t getExifIsoSpeed(); 133 int32_t getExifGpsProcessingMethod(char *gpsProcessingMethod, 134 uint32_t &count); 135 int32_t getExifLatitude(rat_t *latitude, char *latRef); 136 int32_t getExifLongitude(rat_t *longitude, char *lonRef); 137 int32_t getExifAltitude(rat_t *altitude, char *altRef); 138 int32_t getExifGpsDateTimeStamp(char *gpsDateStamp, 139 uint32_t bufLen, rat_t *gpsTimeStamp); 140 bool isVideoBuffersCached(); 141 int32_t updateFocusDistances(cam_focus_distances_info_t *focusDistances); 142 143 bool isAEBracketEnabled(); 144 int32_t setAEBracketing(); 145 bool isFpsDebugEnabled(); 146 bool isHistogramEnabled(); 147 bool isSceneSelectionEnabled(); 148 int32_t setSelectedScene(cam_scene_mode_type scene); 149 cam_scene_mode_type getSelectedScene(); 150 bool isFaceDetectionEnabled(); 151 int32_t setFaceDetectionOption(bool enabled); 152 int32_t setHistogram(bool enabled); 153 int32_t setFaceDetection(bool enabled, bool initCommit); 154 int32_t setFrameSkip(enum msm_vfe_frame_skip_pattern pattern); 155 qcamera_thermal_mode getThermalMode(); 156 int32_t updateRecordingHintValue(int32_t value); 157 int32_t setHDRAEBracket(cam_exp_bracketing_t hdrBracket); 158 bool isHDREnabled(); 159 bool isAutoHDREnabled(); 160 int32_t stopAEBracket(); 161 int32_t updateRAW(cam_dimension_t max_dim); 162 bool isDISEnabled(); 163 bool isAVTimerEnabled(); 164 int32_t setISType(); 165 cam_is_type_t getVideoISType(); 166 cam_is_type_t getPreviewISType(); 167 uint8_t getMobicatMask(); 168 169 cam_focus_mode_type getFocusMode() const; 170 int32_t setNumOfSnapshot(); 171 int32_t adjustPreviewFpsRange(cam_fps_range_t *fpsRange); 172 bool isJpegPictureFormat(); 173 bool isNV16PictureFormat(); 174 bool isNV21PictureFormat(); 175 cam_denoise_process_type_t getDenoiseProcessPlate(cam_intf_parm_type_t type); 176 int32_t getMaxPicSize(cam_dimension_t &dim); 177 int getFlipMode(cam_stream_type_t streamType); 178 bool isSnapshotFDNeeded(); 179 180 bool isHDR1xFrameEnabled(); 181 bool isYUVFrameInfoNeeded(); 182 const char*getFrameFmtString(cam_format_t fmt); 183 bool isHDR1xExtraBufferNeeded(); 184 bool isHDROutputCropEnabled(); 185 186 bool isPreviewFlipChanged(); 187 bool isVideoFlipChanged(); 188 bool isSnapshotFlipChanged(); 189 void setHDRSceneEnable(bool bflag); 190 int32_t updateAWBParams(cam_awb_params_t &awb_params); 191 192 const char *getASDStateString(cam_auto_scene_t scene); 193 bool isHDRThumbnailProcessNeeded(); 194 void setMinPpMask(cam_feature_mask_t min_pp_mask); 195 bool setStreamConfigure(bool isCapture, 196 bool previewAsPostview, bool resetConfig); 197 int32_t addOnlineRotation(uint32_t rotation, uint32_t streamId, 198 int32_t device_rotation); 199 uint8_t getNumOfExtraBuffersForImageProc(); 200 uint8_t getNumOfExtraBuffersForVideo(); 201 uint8_t getNumOfExtraBuffersForPreview(); 202 uint32_t getExifBufIndex(uint32_t captureIndex); 203 bool needThumbnailReprocess(cam_feature_mask_t *pFeatureMask); 204 bool isUbiFocusEnabled(); 205 bool isChromaFlashEnabled(); 206 bool isHighQualityNoiseReductionMode(); 207 bool isTruePortraitEnabled(); 208 size_t getTPMaxMetaSize(); 209 bool isSeeMoreEnabled(); 210 bool isStillMoreEnabled(); 211 bool isOptiZoomEnabled(); 212 213 int32_t commitAFBracket(cam_af_bracketing_t afBracket); 214 int32_t set3ALock(bool lock3A); 215 int32_t setAndCommitZoom(int zoom_level); 216 uint8_t getBurstCountForAdvancedCapture(); 217 uint32_t getNumberInBufsForSingleShot(); 218 uint32_t getNumberOutBufsForSingleShot(); 219 int32_t setLongshotEnable(bool enable); 220 String8 dump(); 221 bool isUbiRefocus(); 222 uint32_t getRefocusMaxMetaSize(); 223 uint8_t getRefocusOutputCount(); 224 bool generateThumbFromMain(); 225 void updateCurrentFocusPosition(cam_focus_pos_info_t &cur_pos_info); 226 void updateAEInfo(cam_3a_params_t &ae_params); 227 bool isDisplayFrameNeeded(); 228 bool isAdvCamFeaturesEnabled(); 229 int32_t setAecLock(const char *aecStr); 230 int32_t updateDebugLevel(); 231 bool is4k2kVideoResolution(); 232 bool isUBWCEnabled(); 233 234 int getBrightness(); 235 int32_t updateOisValue(bool oisValue); 236 int32_t setIntEvent(cam_int_evt_params_t params); 237 bool getofflineRAW(); 238 bool getQuadraCfa(); 239 int32_t updatePpFeatureMask(cam_stream_type_t stream_type); 240 int32_t getStreamPpMask(cam_stream_type_t stream_type, cam_feature_mask_t &pp_mask); 241 int32_t getSharpness(); 242 int32_t getEffect(); 243 int32_t updateFlashMode(cam_flash_mode_t flash_mode); 244 int32_t configureAEBracketing(cam_capture_frame_config_t &frame_config); 245 int32_t configureHDRBracketing(cam_capture_frame_config_t &frame_config); 246 int32_t configFrameCapture(bool commitSettings); 247 int32_t resetFrameCapture(bool commitSettings, bool lowLightEnabled); 248 cam_still_more_t getStillMoreSettings(); 249 void setStillMoreSettings(cam_still_more_t stillmore_config); 250 cam_still_more_t getStillMoreCapability(); 251 cam_dyn_img_data_t getDynamicImgData(); 252 void setDynamicImgData(cam_dyn_img_data_t d); 253 254 int32_t getParmZoomLevel(); 255 int8_t getReprocCount(); 256 int8_t getCurPPCount(); 257 void setReprocCount(); 258 bool isPostProcScaling(); 259 bool isLLNoiseEnabled(); 260 void setCurPPCount(int8_t count); 261 int32_t setQuadraCfaMode(uint32_t value, bool initCommit); 262 int32_t setToneMapMode(uint32_t value, bool initCommit); 263 void setTintless(bool enable); 264 uint8_t getLongshotStages(); 265 int8_t getBufBatchCount(); 266 int8_t getVideoBatchSize(); 267 268 int32_t setManualCaptureMode( 269 QCameraManualCaptureModes value = CAM_MANUAL_CAPTURE_TYPE_OFF); 270 QCameraManualCaptureModes getManualCaptureMode(); 271 int64_t getExposureTime(); 272 273 cam_capture_frame_config_t getCaptureFrameConfig(); 274 void setJpegRotation(int rotation); 275 uint32_t getJpegRotation(); 276 277 void setLowLightLevel(cam_low_light_mode_t value); 278 cam_low_light_mode_t getLowLightLevel(); 279 bool getLowLightCapture(); 280 281 /* Dual camera specific */ 282 bool getDcrf(); 283 int32_t setRelatedCamSyncInfo( 284 cam_sync_related_sensors_event_info_t* info); 285 const cam_sync_related_sensors_event_info_t* 286 getRelatedCamSyncInfo(void); 287 int32_t setFrameSyncEnabled(bool enable); 288 bool isFrameSyncEnabled(void); 289 int32_t getRelatedCamCalibration( 290 cam_related_system_calibration_data_t* calib); 291 int32_t bundleRelatedCameras(bool sync, uint32_t sessionid); 292 uint8_t fdModeInVideo(); 293 bool isOEMFeatEnabled(); 294 295 int32_t setZslMode(bool value); 296 int32_t updateZSLModeValue(bool value); 297 298 bool isReprocScaleEnabled(); 299 bool isUnderReprocScaling(); 300 int32_t getPicSizeFromAPK(int &width, int &height); 301 302 int32_t checkFeatureConcurrency(); 303 int32_t setInstantAEC(uint8_t enable, bool initCommit); 304 305 int32_t getAnalysisInfo( 306 bool fdVideoEnabled, 307 bool hal3, 308 cam_feature_mask_t featureMask, 309 cam_analysis_info_t *pAnalysisInfo); 310 int32_t updateDtVc(int32_t *dt, int32_t *vc); 311 int32_t SetDualCamera(bool value); 312 int32_t setCameraControls(int32_t controls, bool initCommit = true); 313 314 private: 315 QCameraParameters *mImpl; 316 mutable Mutex mLock; 317 }; 318 319 }; // namespace qcamera 320 321 #endif 322