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